Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PositionStream to report correct position; add tests for reading files #2398

Merged
merged 1 commit into from
Apr 25, 2018

Conversation

ChrisJefferson
Copy link
Contributor

This fixes a bug in PositionStream, and also adds a big general test for reading of files, and positions in streams.

@codecov
Copy link

codecov bot commented Apr 24, 2018

Codecov Report

Merging #2398 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2398      +/-   ##
==========================================
+ Coverage   73.82%   73.83%   +<.01%     
==========================================
  Files         484      484              
  Lines      245793   245799       +6     
==========================================
+ Hits       181463   181484      +21     
+ Misses      64330    64315      -15
Impacted Files Coverage Δ
src/streams.c 73.18% <100%> (+0.46%) ⬆️
src/hpc/threadapi.c 43.3% <0%> (-0.11%) ⬇️
src/gasman.c 85.66% <0%> (+0.18%) ⬆️
src/sysfiles.c 37.71% <0%> (+0.35%) ⬆️
hpcgap/lib/hpc/stdtasks.g 64.7% <0%> (+0.51%) ⬆️
lib/streams.gi 31.92% <0%> (+1.26%) ⬆️

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I have only minor nitpicks, but it's also fine to just ignore those.

src/streams.c Outdated

Int ifid = INT_INTOBJ(fid);


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case you end up making other changes: perhaps remove second empty line? or even both empty lines, and then for symmetry change ret = ... to Int ret = ..., and remove the declaration of ret above?

@@ -0,0 +1,104 @@
gap> START_TEST("files.tst");
gap> testRead := function(testName, openFunc, lines, hasPosition)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so... testName is only used for printing in error messages, presumably to identify the failing tests case? openFunc opens a new stream, lines contains the expected content of that stream, and hasPosition indicates whether PositionStream is supported. Correct?

Perhaps add this into a comment, and/or rename lines to expectedLines or expected; and hasPosition to supportsPositionStream?

@fingolfin fingolfin merged commit 31aa775 into gap-system:master Apr 25, 2018
@fingolfin fingolfin added kind: bug Issues describing general bugs, and PRs fixing them kind: bug: wrong result Issues describing bugs that result in mathematically or otherwise wrong results, and PRs fixing them labels May 2, 2018
@fingolfin
Copy link
Member

Clarification for release notes: the bug in PositionStream was that it did not take buffering into account, and thus could return incorrect values.

@fingolfin fingolfin changed the title Fix bug in PositionStream, add tests for reading files Fix PositionStream to report correct position; add tests for reading files May 2, 2018
@ChrisJefferson ChrisJefferson deleted the fix-stream branch June 11, 2018 19:02
@fingolfin fingolfin added the release notes: added PRs introducing changes that have since been mentioned in the release notes label Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug: wrong result Issues describing bugs that result in mathematically or otherwise wrong results, and PRs fixing them kind: bug Issues describing general bugs, and PRs fixing them release notes: added PRs introducing changes that have since been mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants